﻿

<%@ Page Language="C#" AutoEventWireup="true" 
CodeBehind="EstructuraCostoEditForm.aspx.cs" 
Inherits="UILGestion.ObraAdmin.EstructuraCompras.EstructuraCostoEditForm" %>

<%@ Register Assembly="CustomControls" Namespace="CustomControls" TagPrefix="cc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register assembly="EstandarControl" namespace="EstandarControl" tagprefix="cc1" %>

<%@ Register Assembly="WebLib" Namespace="WebLib" TagPrefix="lib" %>
<%@ Import Namespace="System.Web.Script.Services" %>
<%@ Import Namespace="System.Web.Services" %>


<%@ Register src="~/Control/menuObraCtrl.ascx" tagname="menuObraCtrl" tagprefix="uc1" %>
 
<%@ Import Namespace="System.Web.Script.Services" %>
<%@ Import Namespace="System.Web.Services" %>


<%@ Register src="../../Control/ECItemAddOCPanel.ascx" tagname="ECItemAddOCPanel" tagprefix="uc12" %>
<%@ Register src="../../Control/ComparativoListGrid.ascx" tagname="ComparativoListGrid" tagprefix="uc2" %>
<%@ Register src="../../Control/Comparativo001ListGrid.ascx" tagname="Comparativo001ListGrid" tagprefix="uc3" %>

<%@ Register src="../../Control/ECItemElimReAgrupadoPanel.ascx" tagname="ECItemElimReAgrupadoPanel" tagprefix="uc5" %>
<%@ Register src="../../Control/ECItemPartirPanel.ascx" tagname="ECItemPartirPanel" tagprefix="uc6" %>
<%@ Register src="../../Control/ECItemDetallarPanel.ascx" tagname="ECItemDetallarPanel" tagprefix="uc7" %>
<%@ Register src="../../Control/ECItemSeleccionPanel.ascx" tagname="ECItemSeleccionPanel" tagprefix="uc8" %>

<%@ Register src="~/ObraAdmin/EstructuraCompras/RecursoSeleccionPanel.ascx" tagname="RecursoSeleccionPanel" tagprefix="uc9" %>

<%@ Register src="../../Control/ECItemJuntarPanel.ascx" tagname="ECItemJuntarPanel" tagprefix="uc10" %>



<%@ Register src="../../Control/ECItemSeleccionFinalizadoPanel.ascx" tagname="ECItemSeleccionFinalizadoPanel" tagprefix="uc4" %>



<%@ Register src="../OrdenCompras/OrdenCompraListGrid.ascx" tagname="OrdenCompraListGrid" tagprefix="uc11" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../estilos/_common/styles/fonts.css" />
 <link rel="stylesheet" type="text/css" href="../../estilos/_common/styles/global.css" />
 <link rel="stylesheet" type="text/css" href="../../estilos/_common/styles/theme.css" />
  
  <script src="../../Scripts/partirRecurso.js" type="text/javascript"></script>
   <script src="../../Scripts/AgrupadoECItem.js" type="text/javascript"></script>
    <script src="../../Scripts/DividirRecurso.js" type="text/javascript"></script>
 <script src="../../Scripts/AgrupadoReUsoECItem.js" type="text/javascript"></script>

          <script type="text/javascript">

              




              function SelectAgrAll(frmId, id) {
                  var frm = document.getElementById(frmId);
                  var totalSolestxt = document.getElementById("TotalSolesSelPostTextBox");
                  var totalSoles = 0;


                  for (i = 1; i < frm.rows.length; i++) {
                      var checkbox = frm.rows[i].cells[0].childNodes[1];

                      if (checkbox != null)
                          checkbox.checked = document.getElementById(id).checked;

                      if (checkbox.checked) {
                          totalSoles = totalSoles + frm.rows[i].cells[7].childNodes[0].data * 1;

                      }

                  }
                  totalSolestxt.value = redondear(totalSoles, 4);


              };
              function SelectAgrOne(frmId, id) {
                  var frm = document.getElementById(frmId);
                  var totalSolestxt = document.getElementById("TotalSolesSelPostTextBox");

                  var totalSoles = 0;

                  for (i = 1; i < frm.rows.length; i++) {
                      var checkbox = frm.rows[i].cells[0].childNodes[1];

                      if (checkbox != null && checkbox.checked) {
                          totalSoles = totalSoles + frm.rows[i].cells[7].childNodes[0].data * 1;

                      }
                  }

                  totalSolestxt.value = redondear(totalSoles, 4);



              };

    </script>

  
      <script type="text/javascript">
          function SelectAll(frmId, id) {
              var frm = document.getElementById(frmId);
              var totalSolestxt = document.getElementById("totalSolesRecuTextBox");
              var totalDolarestxt = document.getElementById("totalDolarRecuTextBox");
              var totalSoles = 0;
              var totalDolares = 0;

              for (i = 1; i < frm.rows.length; i++) {
                  var checkbox = frm.rows[i].cells[0].childNodes[1];

                  if (checkbox != null)
                      checkbox.checked = document.getElementById(id).checked;
                  if (checkbox.checked) {

                      if (frm.rows[i].cells[9].childNodes[0].data.startsWith("S/.")) {
                          totalSoles = totalSoles + frm.rows[i].cells[9].childNodes[0].data.substring(3) * 1;
                      } else {
                          totalDolares = totalDolares + frm.rows[i].cells[9].childNodes[0].data.substring(1) * 1;
                      }
                  }

              }
              totalSolestxt.value = redondear(totalSoles, 4);
              totalDolarestxt.value = redondear(totalDolares, 4);

          };
          function SelectOne(frmId, id) {
              var frm = document.getElementById(frmId);
              var totalSolestxt = document.getElementById("totalSolesRecuTextBox");
              var totalDolarestxt = document.getElementById("totalDolarRecuTextBox");
              var totalSoles = 0;
              var totalDolares = 0;
              for (i = 1; i < frm.rows.length; i++) {
                  var checkbox = frm.rows[i].cells[0].childNodes[1];

                  if (checkbox != null && checkbox.checked) {

                      if (frm.rows[i].cells[9].childNodes[0].data.startsWith("S/.")) {
                          totalSoles = totalSoles + frm.rows[i].cells[9].childNodes[0].data.substring(3) * 1
                      } else {
                          totalDolares = totalDolares + frm.rows[i].cells[9].childNodes[0].data.substring(1) * 1
                      }
                  }
              }

              totalSolestxt.value = redondear(totalSoles, 4);
              totalDolarestxt.value = redondear(totalDolares, 4);


          };

    </script>

    <title>Estructura Costo Item</title>
     </head>

<script type="text/javascript"  >

  
 
   //    jQuery(function($) {

//            $("#TxFecha").mask("99/99/9999");

//            $("#TxFono").mask("(999) 999-9999");

//            $("#TxPatente").mask("aaaa-99");

    //        $("#TabContainer2_recursosTabPanel_recursoGridView_ctl02_cantidadEditTextBox").mask("999.999");

//            $("#TxLetras").mask("aaaa");

//        });

  

//    function calculoCantidadEdit(inp) {
//        

//        //obtenemos los identificadores
//        var cantidadid = inp.id;
//        var precioid = cantidadid.replace("cantidadEditTextBox", "precioEditTextBox");
//        var totalid = cantidadid.replace("cantidadEditTextBox", "totalEditTextBox");
//        //los objectos

//        var precio = document.getElementById(precioid);
//        var total = document.getElementById(totalid);
//        var cantidad = document.getElementById(cantidadid);

//        var producto=parseFloat(cantidad.value) * parseFloat(precio.value);

//        total.value = producto;
//        total.focus();


//    }

//    function abrir_ventana(value) // url es la url de la pÃ¡gina que quieres abrir
//    {

//        
//        var id = document.getElementsByName('<%= internalid.ClientID %>')[0].value;
//        var prop = "";
//        prop = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=750,height=450";
//        window.open('InsumoRecuAdicionListForm.aspx?idRecurso=' + value.toString() + '&id=' + id + '&accion=Edit&ds=' + d, "", prop); 
//        // + internalfichaid, "", prop);

//    }

//    function ShowMyModalPopup(id) {
//        var modal = $find('ModalPopupExtender1');
//        modal.show();
//        WebService.FetchOneCustomer(id, DisplayResult);
    //    }




    function switchViews(obj, row) {
        var div = document.getElementById(obj);
        var img = document.getElementById('img' + obj);

        if (div.style.display == "none") {
            div.style.display = "inline";
            if (row == 'alt') {
                img.src = "../../Images/expand_button_down.png";
                mce_src = "../../Images/expand_button_down.png";
            }
            else {
                img.src = "../../Images/expand_button.png";
                mce_src = "../../Images/expand_button.png";
            }
            img.alt = "Cerrar para ver otros Recursos";
        }
        else {
            div.style.display = "none";
            if (row == 'alt') {
                img.src = "../../Images/expand_button.png";
                mce_src = "../../Images/expand_button.png";
            }
            else {
                img.src = "../../Images/expand_button.png";
                mce_src = "../../Images/expand_button.png";
            }
            img.alt = "Expand para mostrar Recursos";
        }
    }
    </script>
<body>
    <form id="form1" runat="server" autocomplete="off">
  
   
    <uc1:menuObraCtrl ID="menuObraCtrl1" runat="server" />
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"  
    EnablePartialRendering="true"></asp:ToolkitScriptManager>
      
   <asp:Panel ID="pnlMain" runat="server"
         CssClass="Heading secTitle AreaHeading ms-crm-List-Header " >
<asp:Label ID="Label1" runat="server" Text="EDITAR PARTIDA DE COMPRA" style="font-size: large; color: #960818"></asp:Label>
         </asp:Panel>
          <asp:Panel ID="Panel1" runat="server"
       class="ms-crm-Form-Body" >
                 <table  width="900px">
                 <tr>
                 <td  width="80%">

                 

                   <table >
<tr>
<td>
    <asp:Button ID="refreshButton" runat="server" Text="Restablecer"   CssClass="ms-crm-List-Header"
        onclick="btnContinue_OnClick"    /></td>
<td>
    
        </td>
<td>
<%--    <asp:Button ID="nuevoButton" runat="server" Text="Nuevo"  Font-Size="X-Small"
        onclick="nuevoButton_Click" Width="70px" />--%></td>

 <td>
 <%--<asp:Button ID="aprobarButton" runat="server" Text="Aprobar"  Font-Size="X-Small"
        onclick="aprobarButton_Click" Width="80px" />--%></td>
 
        <td>
           <%-- <asp:Button ID="desaprobarButton" runat="server" onclick="desaprobarButton_Click"  Font-Size="X-Small"
                Text="Desaprobar" Width="80px" />--%>
 </td>
 <td>
    <%--<asp:Button ID="EliminarButton" runat="server" Text="Eliminar" onclick="EliminarButton_Click" Font-Size="X-Small"
        />--%></td> 
</tr>
</table>
                 </td>
                 <td>
                   <table align="left" >
            
            <tr>
                <td>
                    <asp:Button ID="anteriorButton" runat="server" Text="Anterior"  OnClick="btnContinue_OnClick"  CssClass="ms-crm-List-Header" />
                </td>
                <td>
                    <asp:Button ID="siguienteButton" runat="server" Text="Siguiente" OnClick="btnContinue_OnClick"  CssClass="ms-crm-List-Header" />
                </td>
            </tr>
        </table>  
                 </td>
                 </tr>
                 </table>
              
          </asp:Panel>    
           <asp:Panel  runat="server" ID="panMain" BackColor="White">
                          
            <asp:UpdatePanel ID="ECPanel" runat="server" UpdateMode="Conditional">

            <ContentTemplate>


            
  <table width="800px">
  <tr>
  <td width="250px" valign="top">
  Descripcion:<br />
      <asp:Label ID="presupuestoTextBox" runat="server"></asp:Label>
      <input id="internalid" type="hidden" runat="server"/>
      <input id="idObra" type="hidden" runat="server"/>
      <input id="idECJuntaECItemList" type="hidden" runat="server"/>
      <input id="tipoCambioOBRADOL" type="hidden" runat="server"/>
      <input id="simbolMonedaBase" type="hidden" runat="server"/>
  </td>
  <td  width="450px">
  <asp:Panel ID="totalesPanel" runat="server" GroupingText="">
       <table  >
                      <tr style="background-color:LightYellow;">
                      <td align="right" width="200px">Total Base:</td>
                      <td align="right" width="100px"><asp:Label ID="totalPresupuestoLabel" runat="server" Text=""></asp:Label></td>
                          <td align="right" width="100px">
                              <asp:Label ID="totalPresupuestoDLLLabel" runat="server" Text=""></asp:Label>
                          </td>
                      </tr>
                      <tr style="background-color:LightYellow;">
                      <td align="right" width="200px">Total Uso Ordenes: </td>
                      <td align="right" width="100px"> <asp:Label ID="estructuraCostoLabel" runat="server" Text=""></asp:Label></td>
                          <td align="right" width="100px">
                              <asp:Label ID="estructuraCostoDLLLabel" runat="server" Text=""></asp:Label>
                          </td>
                      </tr>
                      <tr>
                      <td align="right" width="200px">Total Saldo: </td>
                      <td align="right" width="100px"><asp:Label ID="totalConfiguradoLabel" runat="server" Text=""></asp:Label></td>
                          <td align="right" width="100px">
                              <asp:Label ID="totalConfiguradoDLLLabel" runat="server" Text=""></asp:Label>
                          </td>
                      </tr>
                      </table>
      </asp:Panel>

  </td>
 <td ></td>
  </table>
    
       </ContentTemplate>
       <Triggers>
        <asp:AsyncPostBackTrigger ControlID="OkButton" />
        <asp:AsyncPostBackTrigger ControlID="finalizarAgrupadoButton" />
        <asp:AsyncPostBackTrigger ControlID="aceptarAddButton" />
        <asp:AsyncPostBackTrigger ControlID="addReABTN" />
       
       </Triggers>
       
       </asp:UpdatePanel>
           
                
  <asp:TabContainer ID="TabContainer2" runat="server" Width="100%" ActiveTabIndex="1">
  
  <asp:TabPanel runat="server"   HeaderText="Recursos" ID="recursosTabPanel">
      <ContentTemplate>
          <asp:Button ID="addRecursoButton" runat="server" OnClick="accionItem_Click" 
              SkinID="Button" Text="Agregar Recurso" />
          <asp:Button ID="AgruparRecursoButton" runat="server" ClientIDMode="Static" 
              OnClick="accionItem_Click" SkinID="Button" Text="Agrupar " />
          <asp:Button ID="eliminarAgrupadoButton" runat="server" 
              OnClick="accionItem_Click" SkinID="Button" Text="Eliminar Agrupado" />
          <asp:LinkButton ID="LinkButton3" runat="server"></asp:LinkButton>
         
          <asp:modalpopupextender ID="AgrupadoTransModalpopupextenderadd" runat="server" 
              BackgroundCssClass="modalBackground" CancelControlID="cancelarAgrupadoButton" 
              dropshadow="True" DynamicServicePath="" Enabled="True" 
              popupcontrolid="agrupadoECItemParentPanel" 
              popupdraghandlecontrolid="agrupadoECItemPanel" targetcontrolid="LinkButton3" />
         
          <asp:modalpopupextender ID="delAgrupadoModalpopupextender" runat="server" 
              BackgroundCssClass="modalBackground" 
              CancelControlID="cancelardelRecursoAgrupadoButton" dropshadow="True" 
              DynamicServicePath="" Enabled="True" popupcontrolid="delAgrupadoParentPanel" 
              popupdraghandlecontrolid="delAgrupadoPanel" RepositionMode="None" 
              targetcontrolid="LinkButton1" X="0" Y="0" />
         
          <asp:modalpopupextender ID="ModalFindPopupExtender" runat="server" 
              BackgroundCssClass="modalBackground" 
              cancelcontrolid="CancelButton" 
              DynamicServicePath="" Enabled="True" popupcontrolid="addRecursoParentPanel" 
              popupdraghandlecontrolid="AddRecursoPanel" targetcontrolid="Button4" X="0" 
              Y="0" />
          <asp:UpdatePanel ID="UpdatePartida" runat="server" UpdateMode="Conditional"><ContentTemplate>
          <asp:GridView 
                  ID="recursoGridView" Runat="Server" AllowSorting="true" 
                  DataKeyNames="idInternal" OnRowDataBound="recursoGridView_RowDataBound" 
                  OnSorting="SortingItem" SkinID="GridView"><Columns><asp:TemplateField><ItemTemplate><asp:ImageButton 
                      ID="imgdiv" runat="server" alt="Click para ver Recursos" BorderColor="Control" 
                      ClientIDMode="Static" CommandArgument="<%# Container.DataItemIndex %>" 
                      CommandName='<%# Eval("idInternal") %>' 
                      ImageUrl="../../Images/expand_button.png" OnClick="cargaDetalle_click" />
                  </ItemTemplate>
                  </asp:TemplateField>
                  <asp:BoundField DataField="idInternal" 
                      HeaderStyle-ForeColor="Blue" HeaderStyle-Width="35px" HeaderText="ID" 
                      ItemStyle-Width="35px" SortExpression="idInternal" /><asp:BoundField 
                      DataField="idRecurso" HeaderStyle-Width="35px" HeaderText="idRecurso." 
                      Visible="false" /><asp:TemplateField HeaderStyle-Width="35px" 
                      HeaderText="Presu." ItemStyle-Width="35px" SortExpression="abreviacion"><ItemTemplate><asp:LinkButton 
                          ID="abreviacioniLabel" runat="server" BorderColor="Control" 
                          CommandArgument='<%# Eval("idPresupuesto")%>' ForeColor="Blue" 
                          OnClick="leerPresupuestoButton_click" Text='<%# Eval("abreviacion")%>'>
                          </asp:LinkButton>
                  </ItemTemplate>
                  </asp:TemplateField><asp:TemplateField ControlStyle-Width="200px" 
                      HeaderStyle-Width="200px" HeaderText="PARTIDA"><ItemTemplate><asp:Label 
                          ID="codDesPartidaLabel" runat="server" BackColor="Transparent" 
                          Text='<%# Eval("codDesPartida")%>' />
                  </ItemTemplate>
                  </asp:TemplateField>
                  
                  <asp:BoundField DataField="descripcion" 
                      HeaderStyle-ForeColor="Blue" HeaderStyle-Width="350px" HeaderText="DESCRIPCION" 
                      SortExpression="descripcion" />
                      
                      <asp:BoundField DataField="unidad" 
                      HeaderStyle-ForeColor="Blue" HeaderStyle-Width="35px" HeaderText="UNID." 
                      SortExpression="unidad" />
                      <asp:BoundField DataField="cantidad" 
                      HeaderStyle-ForeColor="Blue" HeaderText="CANT." 
                      ItemStyle-HorizontalAlign="Right" ItemStyle-Width="95px" 
                      SortExpression="cantidad" />
                      <asp:BoundField DataField="precioMon" 
                      HeaderStyle-ForeColor="Blue" HeaderText="PRECIO" 
                      ItemStyle-HorizontalAlign="Right" ItemStyle-Width="95px" 
                      SortExpression="precio" /><asp:BoundField DataField="totalMon" 
                      HeaderStyle-ForeColor="Blue" HeaderText="TOTAL" 
                      ItemStyle-BackColor="LightGoldenrodYellow" ItemStyle-HorizontalAlign="Right" 
                      ItemStyle-Width="95px" SortExpression="total" /><asp:TemplateField 
                      HeaderText=""><ItemTemplate><asp:ImageButton ID="partirRecursoLinkButton" 
                          runat="server" CommandArgument='<%# Eval("idInternal")%>' 
                          ImageUrl="~/Images/adicionPre.gif" OnClick="partirRecurso_Click" 
                          ToolTip="Parte el recurso " /><asp:ImageButton 
                          ID="DividirRecursoLinkButton" runat="server" 
                          CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/estruct.gif" 
                          OnClick="dividirRecurso_Click" ToolTip="Detalla el Recurso" /><asp:ImageButton 
                          ID="lnkRemove" runat="server" BorderColor="Control" 
                          CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/delete.gif" 
                          OnClick="Deleteitem" 
                          OnClientClick="return confirm('Usted quiere eliminar?.El monto sera devuelto al presupesto')" 
                          ToolTip="Retira el Recurso de la Estructura" />
                  </ItemTemplate>
                  </asp:TemplateField><asp:TemplateField><ItemTemplate><tr><td colspan="100%"><asp:UpdatePanel 
                          ID="UpdateDetalleECItemUpdatePanel" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:Panel 
                              ID="divgrillan1" runat="server" 
                              style="display:none;position:relative;left:25px;"><asp:GridView 
                              ID="GridView2" Runat="Server" DataKeyNames="idInternal,idPadre" 
                              onrowcancelingedit="CancelInsEditItem" OnRowDataBound="GridView2_RowDataBound" 
                              SkinID="GridView"><Columns><asp:TemplateField><ItemTemplate><a 
                                      href="javascript:switchViews('div<%# Eval("idInternal") %>', 'one');"><img 
                                      ID='imgdiv<%# Eval("idInternal") %>' alt="Click para ver recursos" border="0" 
                                      src="../../Images/expand_button.png" /></a>
                                  </ItemTemplate>
                                  </asp:TemplateField><asp:BoundField DataField="codigo" HeaderStyle-Width="35px" 
                                      HeaderText="Codigo" SortExpression="unidad" /><asp:BoundField 
                                      DataField="descripcion" HeaderStyle-Width="350px" HeaderText="descripcion" 
                                      SortExpression="unidad" /><asp:BoundField DataField="unidad" 
                                      HeaderStyle-Width="35px" HeaderText="Unid." SortExpression="unidad" /><asp:BoundField 
                                      DataField="cantidadStr" HeaderText="Cant." ItemStyle-HorizontalAlign="Right" 
                                      ItemStyle-Width="95px" SortExpression="cantidad" /><asp:BoundField 
                                      DataField="precioStr" HeaderText="Precio" ItemStyle-HorizontalAlign="Right" 
                                      ItemStyle-Width="95px" SortExpression="precio" /><asp:BoundField 
                                      DataField="totalStr" HeaderText="Total" ItemStyle-HorizontalAlign="Right" 
                                      ItemStyle-Width="95px" SortExpression="total" /><asp:TemplateField><ItemTemplate><asp:ImageButton 
                                          ID="DividirRecursoInsumoLinkButton" runat="server" 
                                          CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/estruct.gif" 
                                          OnClick="dividirRecurso_Click" /><asp:ImageButton ID="lnkRemoveIns" 
                                          runat="server" BorderColor="Control" CommandArgument='<%# Eval("idInternal")%>' 
                                          ImageUrl="~/Images/delete.gif" OnClick="DeleteInstitem" 
                                          OnClientClick="return confirm('Usted quiere eliminar?.  El monto sera devuelto al presupesto.') " />
                                  </ItemTemplate>
                                  </asp:TemplateField><asp:TemplateField><ItemTemplate><tr><td colspan="100%"><div 
                                          ID='div<%# Eval("idInternal") %>' 
                                          style="display:none;position:relative;left:25px;"><asp:UpdatePanel 
                                          ID="UpdateDetalleDetalleECItemUpdatePanel" runat="server" 
                                          UpdateMode="Conditional"><ContentTemplate><asp:GridView ID="GridView3" 
                                                  Runat="Server" DataKeyNames="idInternal,idPadre" SkinID="GridView"><Columns><asp:BoundField 
                                                      DataField="codigo" HeaderStyle-Width="35px" HeaderText="Codigo" 
                                                      SortExpression="unidad" /><asp:BoundField DataField="descripcion" 
                                                      HeaderStyle-Width="350px" HeaderText="descripcion" SortExpression="unidad" /><asp:BoundField 
                                                      DataField="unidad" HeaderStyle-Width="35px" HeaderText="Unid." 
                                                      SortExpression="unidad" /><asp:BoundField DataField="cantidadStr" 
                                                      HeaderText="Cant." ItemStyle-HorizontalAlign="Right" ItemStyle-Width="95px" 
                                                      SortExpression="cantidad" /><asp:BoundField DataField="precioStr" 
                                                      HeaderText="Precio" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="95px" 
                                                      SortExpression="precio" /><asp:BoundField DataField="totalStr" 
                                                      HeaderText="Total" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="95px" 
                                                      SortExpression="total" /><asp:TemplateField><ItemTemplate><asp:ImageButton 
                                                          ID="lnkRemoveIns" runat="server" BorderColor="Control" 
                                                          CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/delete.gif" 
                                                          OnClick="DeleteInstitem" 
                                                          OnClientClick="return confirm('Usted quiere eliminar?.  El monto sera devuelto al presupesto.') " /><%--    <asp:LinkButton ID="lnkRemoveIns" runat="server" BorderColor="Control" 
                                                                  CommandArgument='<%# Eval("idInternal")%>' OnClick="DeleteInstitem" 
                                                                                                          OnClientClick="return confirm('Usted quiere eliminar?.  El monto sera devuelto al presupesto.') " 
                                                                                                          Text="&lt;img src=&quot;../../Images/delete.gif&quot; /&gt;"></asp:LinkButton>--%>
                                                  </ItemTemplate>
                                                  </asp:TemplateField>
                                              </Columns>
                                              </asp:GridView><%--<asp:Panel id='divgrillan'   runat="server"
                                                                                         style="display:none;position:relative;left:25px;">
                                        --%>
                                          </ContentTemplate>
                                      </asp:UpdatePanel></div></td></tr>
                                  </ItemTemplate>
                                  </asp:TemplateField>
                              </Columns>
                          </asp:GridView></asp:Panel>
                      </ContentTemplate>
                      </asp:UpdatePanel></td></tr></td></tr>
                  </ItemTemplate>
                  </asp:TemplateField>
              </Columns>
              </asp:GridView>
              </ContentTemplate>
              <Triggers>

              <asp:AsyncPostBackTrigger ControlID="OkButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarPartirButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarDividirButton" />
              <asp:AsyncPostBackTrigger ControlID="finalizarAgrupadoButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarAddButton" />
              <asp:AsyncPostBackTrigger ControlID="delRecursoAgrupadoButton" />
              <asp:AsyncPostBackTrigger ControlID="juntarRecursoButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarReAgruparBtn" />
              <asp:AsyncPostBackTrigger ControlID="EliminarReAgruparBtn" />
              <asp:AsyncPostBackTrigger ControlID="addReABTN" />

              
              </Triggers>
          </asp:UpdatePanel>
          <asp:LinkButton ID="LinkButton1" runat="server" />
          <asp:LinkButton 
              ID="LinkButton2" runat="server" />
              <asp:LinkButton ID="LinkButton4" 
              runat="server" /><asp:LinkButton ID="Button23" runat="server" /><asp:LinkButton 
              ID="Button1" runat="server" Width="0px" /><asp:LinkButton ID="Button2" 
              runat="server" Width="0px" /><asp:LinkButton ID="Button4" runat="server" 
              Width="0px" /><asp:LinkButton ID="LinkButton6" runat="server" /><asp:LinkButton 
              ID="LinkButton62" runat="server" /><asp:modalpopupextender 
              ID="ModalDividirPopupExtender" runat="server" 
              BackgroundCssClass="modalBackground" cancelcontrolid="cancelarDividirButton" 
              dropshadow="True" DynamicServicePath="" Enabled="True" 
              okcontrolid="LinkButton6" popupcontrolid="dividirRecursoParentPanel" 
              popupdraghandlecontrolid="dividirRecursoPanel" targetcontrolid="Button1"></asp:modalpopupextender><asp:modalpopupextender 
              ID="ModalPartirPopupExtender" runat="server" 
              BackgroundCssClass="modalBackground" cancelcontrolid="cancelarPartirButton" 
              dropshadow="True" DynamicServicePath="" Enabled="True" 
              okcontrolid="LinkButton62" popupcontrolid="partirRecursoParentPanel" 
              popupdraghandlecontrolid="partirRecursoPanel" targetcontrolid="Button2"></asp:modalpopupextender>
      </ContentTemplate>
      </asp:TabPanel>
      <asp:TabPanel runat="server" HeaderText="Recursos Configurados" 
          ID="recursosConfiguradoTabPanel">
          <ContentTemplate>
             
              <table width="1000px">
                  <tr>
                      <td>
                          <asp:ModalPopupExtender ID="ReAgruparRecursoModalPPE" runat="server" 
                              BackgroundCssClass="modalBackground" CancelControlID="cancelarReAgruparBtn" 
                              DynamicServicePath="" Enabled="True" 
                              PopupControlID="ECItemReAgrupadoPanelPanel" 
                              PopupDragHandleControlID="ECItemReAgrupadoPanel" TargetControlID="LinkButton5"></asp:ModalPopupExtender>
                          <asp:ModalPopupExtender ID="ReEliAgruparRecursoModalPPE" runat="server" 
                              BackgroundCssClass="modalBackground" CancelControlID="CancelarReEliAgruparBtn" 
                              DropShadow="True" DynamicServicePath="" Enabled="True" 
                              PopupControlID="EliReAgrupadoPanelPanel" 
                              PopupDragHandleControlID="EliReAgrupadoPanel" TargetControlID="LinkButton63">
                              </asp:ModalPopupExtender>
                          <asp:LinkButton ID="LinkButton63" runat="server" Width="0px"></asp:LinkButton>
                          <asp:LinkButton ID="LinkButton5" runat="server" Width="0px"></asp:LinkButton>
                          <asp:LinkButton ID="LinkButton333" runat="server" Width="0px"></asp:LinkButton>
                          <asp:ModalPopupExtender ID="juntarModalpopupextender" runat="server" 
                              BackgroundCssClass="modalBackground" CancelControlID="delJuntarRecursoButton" 
                              DynamicServicePath="" Enabled="True" PopupControlID="juntarParentPanel" 
                              PopupDragHandleControlID="juntarPanel" TargetControlID="LinkButton333"></asp:ModalPopupExtender>
                      </td>
                      <td align="right">
                          <asp:Button ID="ReAgruparRecursoButton" runat="server" 
                              OnClick="accionItem_Click" SkinID="Button" Text="Agrupar" 
                              ToolTip="Solo Comparativos finalizados para su Reuso"></asp:Button>
                      </td>
                      <td align="right" Width="35px">
                          <asp:Button ID="eliminarReAgrupadoButton" runat="server" 
                              OnClick="accionItem_Click" SkinID="Button" Text="eliminar Agrupado" 
                              ToolTip="Solo Comparativos finalizados para su Reuso" />
                      </td>
                  </tr>
              </table>
              <asp:UpdatePanel ID="recursosConfiguradosUpdatePanel" runat="server" 
                  UpdateMode="Conditional">
                  
                  <ContentTemplate>
                  <asp:GridView 
                          ID="recursoConfiguradoGridView" Runat="Server" AllowSorting="true" 
                          DataKeyNames="idInternal,bitFinalizadoContrato" 
                          OnRowCreated="ecitemGridView_RowCreated" 
                          OnRowDataBound="itemAgrupadoGridView_RowDataBound" 
                          OnSorting="SortingconfiguradosItem" SkinID="GridView"><Columns><asp:TemplateField><ItemTemplate><asp:Label 
                              ID="totalInsLabel" runat="server" BackColor="Transparent" 
                              Text='<%# Eval("totalUsoMon")%>' ToolTip='<%# Eval("toolTip") %>'>
                                
                </asp:Label>
                          </ItemTemplate>
                          <ItemTemplate>
                              <asp:Panel ID="cagrupadoPanel" runat="server"><a 
                                      href="javascript:switchViews('div<%# Eval("idInternal") %>', 'one');"><img 
                                      ID='imgdiv<%# Eval("idInternal") %>' alt="Click para ver recursos" border="0" 
                                      src="../../Images/expand_button.png" /></a></asp:Panel>
                          </ItemTemplate>
                          </asp:TemplateField><asp:BoundField DataField="idInternal" 
                              HeaderStyle-ForeColor="Blue" HeaderStyle-Width="35px" HeaderText="ID" 
                              ItemStyle-Width="35px" SortExpression="idInternal" /><asp:BoundField 
                              DataField="codigo" HeaderStyle-ForeColor="Blue" HeaderStyle-Width="35px" 
                              HeaderText="CODIGO" SortExpression="idInternal" /><asp:BoundField 
                              DataField="descripcion" HeaderStyle-ForeColor="Blue" HeaderStyle-Width="300px" 
                              HeaderText="DESCRIPCION" SortExpression="descripcion" /><asp:BoundField 
                              DataField="unidad" HeaderStyle-ForeColor="Blue" HeaderText="UNID." 
                              SortExpression="unidad" /><asp:BoundField DataField="cantidadStr" 
                              HeaderStyle-ForeColor="Blue" HeaderStyle-Width="75px" HeaderText="CANTIDAD" 
                              ItemStyle-HorizontalAlign="Right" SortExpression="cantidad" /><asp:BoundField 
                              DataField="cantidadUsoStr" HeaderStyle-ForeColor="Blue" 
                              HeaderStyle-Width="75px" HeaderText="CANT USO" ItemStyle-Font-Bold="false" 
                              ItemStyle-HorizontalAlign="Right" SortExpression="cantidadUso" /><asp:BoundField 
                              DataField="precioMon" HeaderStyle-ForeColor="Blue" HeaderStyle-Width="95px" 
                              HeaderText="PRECIO" ItemStyle-HorizontalAlign="Right" SortExpression="precio" />
                              
                              <asp:TemplateField 
                              HeaderStyle-ForeColor="Blue" HeaderStyle-Width="115px" HeaderText="TOTAL" 
                               ItemStyle-HorizontalAlign="Right" 
                              SortExpression="total"><ItemTemplate><asp:Label ID="Label2" runat="server" 
                                  Text='<%# Eval("totalMon") %>'></asp:Label><asp:Image ID="ImageECItemRef" 
                                  runat="server" src="../../Images/req.gif" ToolTip="Generado por el sistema" />
                          </ItemTemplate>
                          </asp:TemplateField><asp:BoundField DataField="totalUsoMon" 
                              HeaderStyle-ForeColor="Blue" HeaderText="TOTAL USO" 
                               ItemStyle-HorizontalAlign="Right" 
                              ItemStyle-Width="95px" SortExpression="totalUso" /><asp:BoundField 
                              DataField="totalDispMon" HeaderStyle-ForeColor="Blue" HeaderStyle-Width="100px" 
                              HeaderText="TOTAL DISP." ItemStyle-BackColor="LightGoldenrodYellow" 
                              ItemStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right" 
                              SortExpression="totalDisp" />
                              
                              <asp:BoundField DataField="totalReUsoMon" 
                              HeaderStyle-ForeColor="Blue" HeaderStyle-Width="95px" HeaderText="TOTAL REUSO" 
                               ItemStyle-Font-Bold="true" 
                              ItemStyle-HorizontalAlign="Right" SortExpression="totalReUso" />
                              
                              <asp:TemplateField>
                              <ItemTemplate>
                              <asp:ImageButton 
                                  ID="lnkJuntar" runat="server" AlternateText="Juntar recursos" 
                                  BorderColor="Control" CommandArgument='<%# Eval("idInternal")%>' 
                                  ImageUrl="~/Images/dn.gif" OnClick="juntar_click" 
                                  ToolTip="Juntar los Insumos de Igual codigo" /><asp:ImageButton 
                                  ID="lnkdesjuntar" runat="server" AlternateText="Juntar recursos" 
                                  BorderColor="Control" CommandArgument='<%# Eval("idInternal")%>' 
                                  ImageUrl="~/Images/up.gif" OnClick="desagrupar_click" 
                                  OnClientClick="return confirm('Seguro de desea eliminar el Juntar?')" 
                                  ToolTip=" reestablecer los insumos Juntos" />
                          </ItemTemplate>
                          </asp:TemplateField><asp:TemplateField><ItemTemplate></td></tr><tr><td 
                                  colspan="70%"><div ID='div<%# Eval("idInternal") %>' 
                                  style="display: none; position: relative; left: 25px;"><asp:UpdatePanel 
                                      ID="UpdateInsumo" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:GridView 
                                              ID="JuntosGridView" Runat="Server" DataKeyNames="idInternal,idPadre" 
                                              SkinID="GridView"><Columns><asp:BoundField DataField="idInternal" 
                                                  HeaderText="ID" ItemStyle-Width="35px" /><asp:BoundField DataField="codigo" 
                                                  HeaderText="Codigo" ItemStyle-Width="75px" /><asp:BoundField 
                                                  DataField="descripcion" HeaderText="Descripcion" ItemStyle-Width="300px" /><asp:BoundField 
                                                  DataField="unidad" HeaderText="Unidad" ItemStyle-Width="55px" /><asp:BoundField 
                                                  DataField="cantidadDispStr" headerText="Cantidad" 
                                                  ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" /><asp:BoundField 
                                                  DataField="precioStr" HeaderText="Precio" ItemStyle-HorizontalAlign="Right" 
                                                  ItemStyle-Width="100px" /><asp:BoundField DataField="totalDispStr" 
                                                  HeaderText="Total" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
                                          </Columns>
                                          </asp:GridView>
                                      </ContentTemplate>
                                  </asp:UpdatePanel></div></td></tr>
                          </ItemTemplate>
                          </asp:TemplateField>
                      </Columns>
                      </asp:GridView>
                  </ContentTemplate>
                  <Triggers>
                   <asp:AsyncPostBackTrigger ControlID="OkButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarPartirButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarDividirButton" />
              <asp:AsyncPostBackTrigger ControlID="finalizarAgrupadoButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarAddButton" />
              <asp:AsyncPostBackTrigger ControlID="delRecursoAgrupadoButton" />
              <asp:AsyncPostBackTrigger ControlID="juntarRecursoButton" />
              <asp:AsyncPostBackTrigger ControlID="aceptarReAgruparBtn" />
              <asp:AsyncPostBackTrigger ControlID="EliminarReAgruparBtn" />
              <asp:AsyncPostBackTrigger ControlID="addReABTN" />

              
                  </Triggers>
              </asp:UpdatePanel>
          </ContentTemplate>
      </asp:TabPanel>
                                                      <asp:TabPanel runat="server" HeaderText="Comparativos" ID="notasTabPanel">
                                                          <ContentTemplate>
                                                              <asp:Button ID="nuevoComparativoButton" runat="server" 
                                                                  OnClick="nuevoComp_Click" SkinID="Button" Text="Nuevo Comparativo" />
                                                              <br />
                                                              <asp:UpdatePanel ID="comparativilistUpdatePanel" runat="server"><ContentTemplate><uc3:Comparativo001ListGrid 
                                                                      ID="Comparativo001ListGrid1" runat="server" DataSourceID="comparativoODS" /><asp:ObjectDataSource 
                                                                      ID="comparativoODS" runat="server" EnablePaging="True" 
                                                                      SelectCountMethod="Count" SelectMethod="getComparativoList" 
                                                                      SortParameterName="sortExpression" typeName="BOL.ComparativoBL"><SelectParameters><asp:querystringparameter 
                                                                              Name="idEstructuraCosto" querystringfield="id" Type="Int32" /><asp:querystringparameter 
                                                                              Name="idObra" querystringfield="idObra" Type="Int32" /><asp:Parameter 
                                                                              Name="startRowIndex" Type="Int32" /><asp:Parameter Name="maximumRows" 
                                                                              Type="Int32" /><asp:Parameter Name="sortExpression" Type="String" />
                                                                      </SelectParameters>
                                                                  </asp:ObjectDataSource>
                                                                  </ContentTemplate>
                                                              </asp:UpdatePanel>
                                                          </ContentTemplate>
      </asp:TabPanel><asp:TabPanel runat="server" HeaderText="Ordenes" 
                                  ID="AnalisisTabPanel">
          <ContentTemplate>
              <table>
                  <tr>
                      <td width="100px">
                      </td>
                      <td width="100px">
                      </td>
                  </tr>
              </table>
              <asp:Button ID="nuevaOCBTN" runat="server" OnClick="btnContinue_OnClick" 
                  SkinID="Button" Text="Nuevo Orden Compra" />
              <asp:Button ID="nuevaGOBTN" runat="server" OnClick="btnContinue_OnClick" 
                  SkinID="Button" Text="Nuevo Orden Gasto" />
              <asp:UpdatePanel ID="UsoInsumoUpdatePanel" runat="server" 
                  UpdateMode="Conditional"><ContentTemplate><uc11:OrdenCompraListGrid 
                          ID="OrdenCompraListGrid1" runat="server" DataSourceID="ordenCompraODS" /><asp:ObjectDataSource 
                          ID="ordenCompraODS" runat="server" EnablePaging="True" 
                          SelectCountMethod="CountEC" SelectMethod="getOrdenCompraListEC" 
                          SortParameterName="sortExpression" typeName="BOL.OrdenCompraBL"><SelectParameters><asp:querystringparameter 
                                  Name="idEstructuraCosto" querystringfield="id" Type="Int32" /><asp:querystringparameter 
                                  Name="idObra" querystringfield="idObra" Type="Int32" /><asp:Parameter 
                                  Name="startRowIndex" Type="Int32" /><asp:Parameter Name="maximumRows" 
                                  Type="Int32" /><asp:Parameter Name="sortExpression" Type="String" />
                          </SelectParameters>
                      </asp:ObjectDataSource>
                  </ContentTemplate>
              </asp:UpdatePanel>
          </ContentTemplate>
      </asp:TabPanel></asp:TabContainer>

</asp:Panel>          
 



  
  <asp:Panel ID="addRecursoParentPanel" runat="server" Height="490px" >
  <asp:Panel ID="AddRecursoPanel"   runat="server" Height="490px"  Width="1000px"  Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
 
 <asp:UpdatePanel ID="SeleccionUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            <asp:Panel ID="Panel7" runat="server" Height="440px"  
            class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
<uc9:RecursoSeleccionPanel ID="RecursoSeleccionPanel1"  runat="server" />
              
  </asp:Panel>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosTabPanel$addRecursoButton" />
<asp:AsyncPostBackTrigger ControlID="OkButton" />


</Triggers>
</asp:UpdatePanel>


<asp:Panel ID="Panel19" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               <%--  --%>
                     <asp:Button ID="OkButton"  runat="server"  Text="Añadir seleccion"  CssClass="ms-crm-List-Header"
                     onclick="Button2_Click" OnClientClick="return confirm('Usted quiere Agregar los Recursos?')"
                       
                        />
                    <asp:Button ID="CancelButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 



        </asp:Panel>
</asp:Panel>


<asp:Panel ID="partirRecursoParentPanel" runat="server" Height="470px" >
  <asp:Panel ID="partirRecursoPanel"   runat="server" Height="470px"  Width="800px"  Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">

  <asp:Panel ID="Panel3" runat="server" Height="440px"  class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
    <uc6:ECItemPartirPanel ID="ECItemPartirPanel1" runat="server"  />
    </asp:Panel>
 <asp:Panel ID="Panel2" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="aceptarPartirButton"  runat="server"  Text="Guardar Particion"  CssClass="ms-crm-List-Header"
                      onclick="aceptarPartirButton_Click"  OnClientClick="return confirm('Usted quiere Partir  los Recursos?')"
                       
                        />
                    <asp:Button ID="cancelarPartirButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 
           
          
        </asp:Panel>
</asp:Panel>


<asp:Panel ID="dividirRecursoParentPanel" runat="server" Height="470px" >
  <asp:Panel ID="dividirRecursoPanel"   runat="server" Height="470px"  Width="900px"  Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
  <asp:Panel ID="Panel13" runat="server" Height="440px"  class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
   
      <uc7:ECItemDetallarPanel ID="ECItemDetallarPanel1" runat="server" />
    </asp:Panel>
 <asp:Panel ID="Panel14" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="aceptarDividirButton"  runat="server"  Text="Guardar Detalle"  CssClass="ms-crm-List-Header"
                      onclick="aceptarDividirButton_Click"  
                       
                        />
                    <asp:Button ID="cancelarDividirButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 
           
          
        </asp:Panel>
</asp:Panel>



<asp:Panel ID="agrupadoECItemParentPanel" runat="server" Height="480px" >
  <asp:Panel ID="agrupadoECItemPanel" runat="server"  Height="480px"  Width="1000px"
   Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
   
  
           
           <asp:UpdatePanel ID="partirUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>


                <asp:Panel ID="Panel5" runat="server" CssClass="Heading secTitle AreaHeading ms-crm-List-Header " >
                Agrupar Recurso
                </asp:Panel>

                <asp:Panel ID="Panel8" runat="server"  class="ms-crm-Form-Body" Height="430px" >
                 <input id="idEstructuraCostoPartir" type="hidden"  runat="server" />
                               <input id="idRecursoList" type="hidden"  runat="server" />
                               <lib:Input id="idRecursoNewList" type="hidden"  ReadOnly="true" Width="0" runat="server" />
                               
                               <input id="simbolMoneda" type="hidden"  runat="server" />
                               <input id="idformView" type="hidden"  runat="server" />
                               <input id="simbolOBRADOL" type="hidden"  runat="server" />
                               

                <asp:UpdatePanel ID="totalesUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
          
          <table width="100%">
          <tr>
          <td  align="left" >
          <table style="background-color:White" >
          <tr>
          <td>Tipo de Cambio de la Obra:</td>
          <td><asp:Label ID="tipoCambioLBL" runat="server" Text=""></asp:Label></td>
          </tr>
          </table>
          </td>
          <td align="right">
          
            
<table  class="PanelTotales" >
          
           
              <tr>
                <td align="right" width="150px">
                    Total Recursos:</td>
                <td>
                    <asp:Label ID="TotalRecursoLabel" runat="server"></asp:Label>
                </td>
            </tr>
             <tr>
                <td align="right" width="150px">
                    Total Nuevos Recursos:</td>
                <td>
                
                    <asp:Label ID="TotalDetalleLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right" width="150px">
                    Saldo:</td>
                <td>
                    <asp:Label ID="saldoLabel" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            </table>
            </td>
          </tr>
          </table>
            </ContentTemplate>
            </asp:UpdatePanel>                                             
 
        

            
<asp:TabContainer ID="AgrupadoTabContainer" runat="server" Width="100%" ActiveTabIndex="0">
<asp:TabPanel runat="server" HeaderText="Recursos" ID="recursosAgrTabPanel">
<ContentTemplate>
<asp:LinkButton ID="LinkButtonAgr4" runat="server" />
<asp:LinkButton ID="LinkButton7" runat="server" />

<asp:ModalPopupExtender ID="AddRecursoECItemPopup" runat="server" 
            BackgroundCssClass="modalBackground"
             CancelControlID="cancelarAddButton" 
            DropShadow="True" DynamicServicePath="" Enabled="True" 
            OkControlID="LinkButtonAgr4" 
            PopupControlID="addRecurso2ParentPanel" 
            PopupDragHandleControlID="addRecurso2Panel" 
            TargetControlID="LinkButton7" />
            
            <asp:Panel ID="Panel15" runat="server" Height="300px" ScrollBars="Vertical" BackColor="White" 
    BorderColor="LightSteelBlue" BorderStyle="Solid" BorderWidth="1px"   >
    <asp:UpdatePanel ID="itemAgrupadoUpdatePanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    <table>
    <tr><td>Moneda:</td>
    <td><asp:DropDownList ID="monedaDDL" runat="server" AutoPostBack="True" 
        onselectedindexchanged="monedaDDL_SelectedIndexChanged" Width="200px"></asp:DropDownList></td><td><asp:Button ID="agrupadoSelectBTN" runat="server" CssClass="ms-crm-List-Header" 
                OnClick="addRecursosAgrupado" Text="Agregar Recursos" /></td></tr></table><asp:GridView ID="itemAgrupadoGridView" 
       Runat="server" 
       AutoGenerateColumns="False" 
       DataKeyNames="idInternal"  
      SkinID="GridView"

      onrowcancelingedit="CancelselecItem" 
                            onrowediting="EditselecItem" 
                            OnRowUpdating="UpdateselecItem" 
                             OnRowDataBound="RowDataBoundselecitem"
     
><Columns><asp:TemplateField HeaderText="Presp." HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:Label ID="prespLBL" runat="server" BackColor="Transparent"   
                                    Text='<%# Eval("presupuesto")%>' Width="35px" /></ItemTemplate><EditItemTemplate><asp:Label ID="prespTXT" runat="server"    
                           Text='<%# Eval("presupuesto")%>' Width="35px" /></EditItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Partida" HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:Label ID="partidaLBL" runat="server" BackColor="Transparent"   
                                    Text='<%# Eval("partida")%>' Width="220px" /></ItemTemplate><EditItemTemplate><asp:Label ID="partidaTXT" runat="server" ReadOnly="true"    
                           Text='<%# Eval("partida")%>' Width="220px" /></EditItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Codigo" HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:Label ID="codigoLBL" runat="server" 
                                    Text='<%# Eval("codigo")%>' Width="65px" /></ItemTemplate><EditItemTemplate><asp:Label ID="codigoTXT" runat="server" 
                           Text='<%# Eval("codigo")%>' Width="65px"/></EditItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Descripcion" HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:Label ID="descripcionLBL" runat="server" 
                                    Text='<%# Eval("descripcion")%>' Width="230px" /></ItemTemplate><EditItemTemplate><asp:Label ID="descripcionTXT" runat="server" 
                           Text='<%# Eval("descripcion")%>' Width="230px"/></EditItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Unid." HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:Label ID="unidadLBL" runat="server" 
                                    Text='<%# Eval("unidad")%>' Width="35px" /></ItemTemplate><EditItemTemplate><asp:Label ID="unidadTXT" runat="server" 
                           Text='<%# Eval("unidad")%>' Width="35px"/></EditItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Cant." HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:Label ID="cantidadLBL" runat="server" 
                                    Text='<%# Eval("cantidadStr")%>' Width="55px" /></ItemTemplate><EditItemTemplate><asp:Label ID="cantidadTXT" runat="server" 
                           Text='<%# Eval("cantidadStr")%>' Width="55px"/></EditItemTemplate></asp:TemplateField>
                           
                           <asp:TemplateField HeaderText="Precio" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="precioLBL" runat="server" 
                                    Text='<%# Eval("precioStr")%>' Width="95px" /></ItemTemplate>
                                    <EditItemTemplate><asp:Label ID="precioTXT" runat="server" 
                           Text='<%# Eval("precioStr")%>' Width="95px"/></EditItemTemplate></asp:TemplateField>
                           
                           <asp:TemplateField HeaderText="Disponible" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="totalLBL" runat="server" BackColor="Transparent"   
                                    Text='<%# Eval("totalStr")%>' Width="100px" />
                                    </ItemTemplate><EditItemTemplate><lib:Input ID="totalTXT" runat="server" 
                           Text='<%# Eval("total")%>' Width="100px"></lib:Input></EditItemTemplate><FooterTemplate><asp:DropDownList 
                                ID="formaPagoInsertDropDownList" runat="server" Width="200px"></asp:DropDownList></FooterTemplate></asp:TemplateField><asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/cancel.gif" 
                            EditImageUrl="~/Images/edit.gif" ShowEditButton="true" 
                            UpdateImageUrl="~/Images/update.gif" /><asp:TemplateField><ItemTemplate><asp:ImageButton ID="lnkRemove" runat="server" BorderColor="Control" 
                        CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/delete.gif" 
                        OnClick="DeleteAgrupadoItem" 
                        OnClientClick="return confirm('Usted quiere eliminar?.El Recurso sera  devuelto a la estructura')" /></ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></asp:Panel></ContentTemplate></asp:TabPanel>

<asp:TabPanel runat="server" HeaderText="Nuevos Recursos" ID="recursosnewTabPanel"><ContentTemplate><asp:Button ID="REAddFromOC" runat="server" Text="Agregar Desde O/C" OnClick="addRecursosFromOC" 
CssClass="ms-crm-List-Header" />
<asp:LinkButton ID="LinkButton8" runat="server" />

<asp:ModalPopupExtender ID="ModalPopupExtenderOC" runat="server" 
            BackgroundCssClass="modalBackground"
             CancelControlID="cancelAddFromOCBTN" 
            DropShadow="True" 
            DynamicServicePath="" 
            Enabled="True" 
            x="0"
            y="0"
            PopupControlID="AddFromOCPanelPanel" 
            PopupDragHandleControlID="AddFromOCPanel" 
            TargetControlID="LinkButton8" /><asp:Panel ID="Panel16" runat="server" Height="310px" ScrollBars="Vertical" BackColor="White" 
                       BorderColor="LightSteelBlue" BorderStyle="Solid" BorderWidth="1px"   >
                       <asp:UpdatePanel ID="newrecursoUpdatePanel" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:GridView ID="itemGridView" 
       Runat="server" 
       AutoGenerateColumns="False" 
       DataKeyNames="idInternal"  
       ShowFooter = "True"       
     SkinID="GridView"><Columns><asp:TemplateField HeaderText="Codigo"><ItemTemplate><asp:Label ID="codigoLabel" runat="server" BackColor="Transparent" Text='<%# Eval("codigo")%>' > </asp:Label></ItemTemplate><EditItemTemplate><asp:Label ID="codigoLabel" runat="server" BackColor="Transparent" Text='<%# Eval("codigo")%>' > </asp:Label></EditItemTemplate><FooterTemplate><lib:Input ID="codigoInsertTextBox" runat="server" BackColor="Transparent" ReadOnly="true" Width="70px" /><lib:Input ID="descripcionInsertTextBox1" runat="server"  BackColor="Transparent"  ReadOnly="true" Width="0px" /></FooterTemplate></asp:TemplateField><asp:TemplateField HeaderText="descripcion"><ItemTemplate><asp:Label ID="descripcionLabel" runat="server" BackColor="Transparent"  Text='<%# Eval("descripcion")%>'>
     </asp:Label></ItemTemplate><EditItemTemplate><asp:Label ID="descripcionLabel" runat="server" Width="300px"  BackColor="Transparent" Text='<%# Eval("descripcion")%>'> 
     </asp:Label></EditItemTemplate><FooterTemplate><lib:Input ID="descripcionInsertTextBox" runat="server"   
     backcolor="#DFE8F6" DataType="List" method="GetRecursoDisponible"   
      onchange="javascript:validarRecursoAgrupadoInsert(this);" 
                                              OnSelect="SelectRecursoAgrupadoInsert" Width="300px" /></FooterTemplate></asp:TemplateField><asp:TemplateField HeaderText="Unid."><ItemTemplate><asp:Label ID="unidad45Label" runat="server" BackColor="Transparent" Text='<%# Eval("unidad")%>' Width="35px">                                   </asp:Label></ItemTemplate><EditItemTemplate><asp:Label ID="unidad45Label" runat="server" BackColor="Transparent" Text='<%# Eval("unidad")%>' Width="35px"> </asp:Label></EditItemTemplate><FooterTemplate><lib:Input ID="unidadInsertTextBox" runat="server" BackColor="Transparent"  ReadOnly="true" Width="35px" /></FooterTemplate></asp:TemplateField><asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Right" ><ItemTemplate><asp:Label ID="cantidadLabel" runat="server" BackColor="Transparent" 
                                      Text='<%# Eval("cantidadStr")%>'/></ItemTemplate><FooterTemplate><lib:Input ID="cantidadDividirInsertTextBox" runat="server" BackColor="Transparent"  
                                      Width="75px"  onchange="javascript:calcularTotalXCantAgrupado(this);"  DataType="Double"
                                  /></FooterTemplate></asp:TemplateField><asp:TemplateField HeaderText="Precio" ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="precio2Label" runat="server" BackColor="Transparent" Text='<%# Eval("precioStr")%>'>
                                   </asp:Label></ItemTemplate><FooterTemplate><lib:Input ID="precioInsertTextBox" runat="server" BackColor="Transparent"  Width="95px" 
onchange="javascript:calcularTotalXPrecioAgrupado(this);" DataType="Double"  /></FooterTemplate></asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right" ><ItemTemplate><asp:Label ID="totalLabel" runat="server" BackColor="Transparent"  Text='<%# Eval("totalStr")%>' > 
</asp:Label></ItemTemplate><FooterTemplate>
<table width="100%"><tr><td></td><td><b></b><asp:Label 
                        ID="totalBaseInsertLabel" runat="server" BackColor="Transparent" Width="100%" /></div></td></tr></table><lib:Input ID="totalInsertTextBox" runat="server" BackColor="Transparent" 
                                   TabIndex="3"   DataType="Double" 
                                  onchange="javascript:calcularPrecioXTotalAgrupado(this);"  />
                                  </FooterTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:ImageButton ID="ImageButton1" runat="server"  Width="15px"
                                OnClientClick="return confirm('Usted quiere eliminar?')" 
                                 CommandArgument='<%# Eval("idInternal")%>'  OnClick="DeleteItem" 
                                  ImageUrl="~/estilos/_imgs/delete.gif" /></ItemTemplate><FooterTemplate><asp:Button ID="btnAdd" runat="server" onclick="AddItem"  Text="Añadir"></asp:Button></FooterTemplate></asp:TemplateField><asp:BoundField DataField="numOrdenCompra" HeaderText="O/C" /></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></asp:Panel></ContentTemplate></asp:TabPanel>
                                  
                                  </asp:TabContainer>
  </asp:Panel>


   
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosTabPanel$AgruparRecursoButton" />
<asp:AsyncPostBackTrigger ControlID="finalizarAgrupadoButton" />
<asp:AsyncPostBackTrigger ControlID="aceptarAddButton" />
<asp:AsyncPostBackTrigger ControlID="addOcItemBTN" />

</Triggers>
               </asp:UpdatePanel>
         
  
 <asp:Panel ID="Panel4" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="finalizarAgrupadoButton"  runat="server"  Text="Guardar "  CssClass="ms-crm-List-Header"
                      onclick="accionAgrupado_Click"   OnClientClick="return confirm('Usted quiere Agrupar los Recursos?')"
                       
                        />
                    <asp:Button ID="cancelarAgrupadoButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>

        </asp:Panel>
</asp:Panel>  
 </asp:Panel>
  

<asp:Panel ID="addRecurso2ParentPanel" runat="server" Height="400px"  >
  <asp:Panel ID="addRecurso2Panel"   runat="server" Height="400px"  Width="800px" 
   Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
  <asp:Panel ID="Panel9" runat="server" Height="370px"  class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
   
<uc8:ECItemSeleccionPanel ID="ECItemSeleccionPanel1" runat="server" />
    </asp:Panel>
 <asp:Panel ID="Panel10" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="aceptarAddButton"  runat="server"  Text="Agregar "  CssClass="ms-crm-List-Header"
                      onclick="aceptarAddButton_Click"  OnClientClick="return confirm('Usted quiere Seleccion los Recursos?')"
                       
                        />
                    <asp:Button ID="cancelarAddButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 
           
          
        </asp:Panel>
    
</asp:Panel>




      <asp:Panel ID="delAgrupadoParentPanel" runat="server"   CssClass="modalPopup">
  <asp:Panel ID="delAgrupadoPanel"   runat="server"    
  BorderColor="LightBlue"  BorderStyle="Solid" Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
              
 

        <asp:Panel ID="Panel17" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="delRecursoAgrupadoButton"  runat="server"  Text="Eliminar "  CssClass="ms-crm-List-Header"
                      onclick="delRecursoAgrupado_Click"    OnClientClick="return confirm('Seguro que desea eliminar la Transacción?')" 
                       
                        />
                    <asp:Button ID="cancelardelRecursoAgrupadoButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 


 <asp:Panel ID="Panel6" runat="server"  
          class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
      <asp:UpdatePanel ID="delAgrupadoUpdatePanel" runat="server" UpdateMode="Conditional">
      <ContentTemplate>
  
      <uc5:ECItemElimReAgrupadoPanel ID="ECItemElimReAgrupadoPanel2" DataSourceID="EcitemODS" runat="server" />
                 
      <asp:ObjectDataSource ID="EcitemODS" runat="server" EnablePaging="True" 
        SelectCountMethod="Count" SelectMethod="GetAgrupadoList" 
        SortParameterName="sortExpression"
        TypeName="BOL.EstructuraCostoBL">
        <SelectParameters>
            
            <asp:QueryStringParameter Name="idEstructuraCosto" Type="Int32" DefaultValue="0" QueryStringField="id" />
            <asp:QueryStringParameter Name="idOrigen" Type="Int32" DefaultValue="1" QueryStringField="idOrigen" />
            <asp:Parameter Name="startRowIndex" Type="Int32" />
            <asp:Parameter Name="maximumRows" Type="Int32" />
            <asp:Parameter Name="sortExpression" Type="String" />
        </SelectParameters>
        
    </asp:ObjectDataSource>


      </ContentTemplate>


      <Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosTabPanel$eliminarAgrupadoButton" />
<asp:AsyncPostBackTrigger ControlID="delRecursoAgrupadoButton" />



</Triggers>


      
      </asp:UpdatePanel>

       
  
               
           </asp:Panel>



        </asp:Panel>
          </asp:Panel>
      

      <asp:Panel ID="juntarParentPanel" runat="server" Height="400px" >
  <asp:Panel ID="juntorPanel"   runat="server" Height="400px"  Width="900px"  
  Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
               <asp:Panel ID="Panel23" runat="server" Height="370px" 
          class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">



          <asp:UpdatePanel ID="JuntarUpdatePanel" runat="server"  UpdateMode="Conditional">

         <ContentTemplate>
         
        

             <uc10:ECItemJuntarPanel ID="ECItemJuntarPanel1" runat="server" />
        


        

            </ContentTemplate>
            
         </asp:UpdatePanel>
          </asp:Panel>



          <asp:Panel ID="Panel21" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="juntarRecursoButton"  runat="server" 
                      Text="Guardar "  CssClass="ms-crm-List-Header"
                      onclick="recursoJuntar_Click"    OnClientClick="return confirm('Seguro que desea Juntar?')" 
                       
                        />
                    <asp:Button ID="delJuntarRecursoButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 

        </asp:Panel>
          </asp:Panel>

   

          <asp:Panel ID="ECItemReAgrupadoPanelPanel" runat="server" Height="480px" >
  <asp:Panel ID="ECItemReAgrupadoPanel" runat="server"  Height="480px"  Width="1000px"
   Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">

     <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
    
               <asp:Panel ID="Panel12" runat="server" CssClass="Heading secTitle AreaHeading ms-crm-List-Header " >
               Re Agrupar Recursos 
                </asp:Panel>
              
                <asp:Panel ID="REUSOPanel" runat="server"    Width="100%"     class="ms-crm-Form-Body"  >

        
           <input id="idreUsoECItemList" type="hidden"  runat="server" />
           
           
            <input id="idNewInsumosECItemList" type="hidden"  runat="server" />
            
            <asp:UpdatePanel ID="AddECItemUpdatePanel" runat="server"   UpdateMode="Conditional">
         <ContentTemplate>

             <table width="100%">
             <tr>
             <td>
             

             <table >
             <tr>
             <td></td>
             <td></td>
             </tr>

                 

                 <tr>
                 <td></td>
                 <td align="left">
                    
                   
                    
                      

                 </td>
                 </tr>

                 </table>


                 </td>
             <td align="right">
               
                   <asp:UpdatePanel ID="totalesUNL" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            
<table  class="PanelTotales" >
            <tr>
                    <td  align="right">
                        Total Recurso:</td>
                    <td >
                       
                        <asp:Label ID="totalRecursoLBL" runat="server"></asp:Label>
                       
                    </td>
                    
                 
                </tr>
                <tr>
                <td align="right">
                        Total detalle:</td>
                    <td>
                        <asp:Label ID="totalNewUsoLBL" runat="server"></asp:Label>
                    </td>
                     
                </tr>
                <tr>
                <td align="right">
                        Saldo:</td>
                    <td width="100px" >
                        <asp:Label ID="saldoReAgrupadoLBL" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
            </table>
            </ContentTemplate>
            </asp:UpdatePanel>                                             
 

             </td>
             </tr>
             </table>
         </ContentTemplate>
            </asp:UpdatePanel>   
     

          
            <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"  Width="100%" >
           
           
            <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="Comparativos Finalizados"><ContentTemplate><asp:UpdatePanel ID="recursoItemUpdatePanel" runat="server" 
                    UpdateMode="Conditional"><ContentTemplate>
                    <table><tr><td><b>Moneda:</b> </td><td><cc2:DropDownCC ID="MonedaSeleccionDDL" 
        runat="server" AutoPostBack="true"  
        onselectedindexchanged="MonedaSeleccionDDL_Chk" Width="200"></cc2:DropDownCC><asp:ModalPopupExtender 
        ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground" 
        CancelControlID="cancelarAddFinButton" DropShadow="True" DynamicServicePath="" 
        Enabled="True" PopupControlID="addRecurso3ParentPanel" 
        PopupDragHandleControlID="addRecurso3Panel" TargetControlID="LinkButton77" /><asp:LinkButton 
        ID="LinkButton77" runat="server" /></td><td><asp:Button 
            ID="reusoFinalizadosBTN" runat="server" CssClass="ms-crm-List-Header" 
            OnClick="addRecursosAgrupado" Text="Agregar Recursos" /></td></tr></table><input 
                            id="simbolMonedaLabel" runat="server" type="hidden" /><asp:Panel 
                            ID="Panel22" runat="server" BackColor="White" BorderColor="LightSteelBlue" 
                            BorderStyle="Solid" BorderWidth="1px" Height="280px" ScrollBars="Vertical">
                            
                            <asp:GridView 
                                ID="reUsoECItemGridView" runat="server" DataKeyNames="idInternal" 
                                onrowcancelingedit="CancelItemFin" onrowediting="EditItemFin" 
                                OnRowUpdating="UpdateItemFin" SkinID="GridView" Width="100%">
                                
                                <Columns><asp:TemplateField 
                                        HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="75px" 
                                        HeaderText="COMPARATIVO">
                                        <ItemTemplate><asp:Label ID="comparativoLabel" 
                                            runat="server" BackColor="Transparent" Text='<%# Eval("comparativo")%>' />
                                            </ItemTemplate><EditItemTemplate><asp:Label ID="comparativoEditLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("comparativo")%>' />
                                            </EditItemTemplate></asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" 
                                        HeaderStyle-Width="75px" HeaderText="CODIGO"><ItemTemplate><asp:Label 
                                            ID="codigoLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("codigo")%>' /></ItemTemplate><EditItemTemplate><asp:Label ID="codigoEditLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("codigo")%>' /></EditItemTemplate>
                                            </asp:TemplateField><asp:TemplateField HeaderStyle-HorizontalAlign="Left" 
                                        HeaderStyle-Width="350px" HeaderText="DESCRIPCION">
                                        <ItemTemplate><asp:Label 
                                            ID="descripcionLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("descripcion")%>' /></ItemTemplate><EditItemTemplate><asp:Label ID="descripcionEditLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("descripcion")%>' /></EditItemTemplate>
                                            </asp:TemplateField><asp:TemplateField HeaderStyle-HorizontalAlign="Left" 
                                        HeaderStyle-Width="30px" HeaderText="UNID."><ItemTemplate>
                                        <asp:Label 
                                            ID="unidadLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("unidad")%>' /></ItemTemplate><EditItemTemplate><asp:Label ID="unidadEditLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("unidad")%>' /></EditItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-HorizontalAlign="Right" 
                                        HeaderStyle-Width="75px" HeaderText="TOTAL DISP." 
                                        ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="totalDispLabel" 
                                            runat="server" BackColor="Transparent" Text='<%# Eval("totalDispStr")%>' /></ItemTemplate><EditItemTemplate><asp:Label ID="totalDispEditLabel" runat="server" BackColor="Transparent" 
                                            Text='<%# Eval("totalDispStr")%>' /></EditItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderStyle-HorizontalAlign="Right" 
                                        HeaderStyle-Width="75px" HeaderText="TOTAL REUSO" 
                                        ItemStyle-HorizontalAlign="Right"><ItemTemplate><asp:Label ID="totalReUsoLabel" 
                                            runat="server" BackColor="Transparent" Text='<%# Eval("totalReUsoStr")%>' /></ItemTemplate><EditItemTemplate><lib:Input ID="totalDispEditTxt" runat="server" BackColor="Transparent" 
                                            DataType="Double" Text='<%# Eval("totalReUso")%>' />
                                            </EditItemTemplate>
                                            </asp:TemplateField>
                                            <asp:CommandField ButtonType="Image" 
                                        CancelImageUrl="~/Images/cancel.gif" EditImageUrl="~/Images/edit.gif" 
                                        HeaderStyle-Width="20px" ShowEditButton="true" 
                                        UpdateImageUrl="~/Images/update.gif" /><asp:TemplateField 
                                        HeaderStyle-Width="20px"><ItemTemplate><asp:ImageButton ID="lnkRemove" 
                                            runat="server" BorderColor="Control" CommandArgument='<%# Eval("idInternal")%>' 
                                            ImageUrl="~/Images/delete.gif" OnClick="DeleteItemFin" 
                                            OnClientClick="return confirm('Usted quiere eliminar?')" /></ItemTemplate></asp:TemplateField></Columns></asp:GridView></asp:Panel></ContentTemplate></asp:UpdatePanel></ContentTemplate></asp:TabPanel>
                                    
                                    
        <asp:TabPanel ID="TabPanel2" runat="server" HeaderText="Nuevo Uso"><ContentTemplate><asp:Panel ID="Panel26" runat="server" Height="280px" ScrollBars="Vertical" BackColor="White" 
                       BorderColor="LightSteelBlue" BorderStyle="Solid" BorderWidth="1px"   ><asp:Button ID="AddFromOCBTN" runat="server" Text="Agregar Desde O/C" OnClick="addRecursosFromOC" 
CssClass="ms-crm-List-Header" /><asp:UpdatePanel ID="recursoNewItemUpdatePanel" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:GridView ID="nuevoUsoAgrupadoGridView" 
                SkinID="GridView" 
                    ShowFooter="true"
                Width="100%"
                 
                runat="server" 
               
                DataKeyNames="idInternal" 
                onrowcancelingedit="CancelNewItemRen" 
                onrowediting="EditNewItemRen" 
                OnRowUpdating="UpdateNewItemRen" 
              ><Columns>
              <asp:TemplateField HeaderText="CODIGO" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="75px">
              <ItemTemplate><asp:Label ID="codigoLabel" runat="server" BackColor="Transparent" Text='<%# Eval("codigo")%>'
                Width="75px" /></ItemTemplate>
                <EditItemTemplate><lib:Input ID="codigoEditTxt" runat="server"
                  BackColor="Transparent" Text='<%# Eval("codigo")%>' 
                Width="75px" ReadOnly="true"
                 /></EditItemTemplate><FooterTemplate>
                 <lib:Input ID="codigoInsertTxt" runat="server" 
                               BackColor="Transparent"  ReadOnly="true" BorderColor="Transparent" Width="75px">

                 </lib:Input></FooterTemplate>
                 </asp:TemplateField><asp:TemplateField HeaderText="DESCRIPCION"    HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="360px"><ItemTemplate><asp:Label ID="descripcionLabel" runat="server" BackColor="Transparent" Text='<%# Eval("descripcion")%>'  /></ItemTemplate><EditItemTemplate><lib:Input ID="descripcionEditTxt" runat="server"  BackColor="Transparent"  Text='<%# Eval("descripcion")%>' 
                                        DataType="List" method="GetRecursoDisponible"  OnSelect="SelectEdit"
                          onchange="javascript:validarEdit(this);"  
                          Width="330px" /><lib:Input ID="descripcion2EditTxt" runat="server"  BackColor="Transparent"  
                          ReadOnly="true"   Width="0"    Text='<%# Eval("descripcion")%>' />
                          <lib:Input ID="idInsumoEditTxt" runat="server" Text='<%# Eval("codigo")%>'  ReadOnly="true"  
                           BackColor="Transparent" Width="0"></lib:Input></EditItemTemplate>
                           <FooterTemplate><lib:Input ID="descripcionInsertTxt" runat="server"  BackColor="Transparent"  
                     DataType="List" method="GetRecursoDisponible"  OnSelect="SelectInsert"
                     onchange="javascript:validarInsert(this);"  Width="330px"  />
                     <lib:Input ID="idInsumoInsertTxt" runat="server"  ReadOnly="true"  BackColor="Transparent"
                      Width="0" />
                      <lib:Input ID="descripcionInsert2TextBox" runat="server"  ReadOnly="true" 
                      BackColor="Transparent" Width="0" /></FooterTemplate></asp:TemplateField>
                      <asp:TemplateField HeaderText="UNID." HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="30px">
                      <ItemTemplate><asp:Label ID="unidadLabel" runat="server" BackColor="Transparent"
                       Text='<%# Eval("unidad")%>'   /></ItemTemplate><EditItemTemplate>
                       <lib:Input ID="unidadEditTxt" runat="server" BackColor="Transparent"
                        Text='<%# Eval("unidad")%>' Width="30px" ReadOnly="true"  />
                        </EditItemTemplate><FooterTemplate><lib:Input ID="unidadInsertTxt" runat="server"
                         BackColor="Transparent"  Width="30px"  ReadOnly="true"/></FooterTemplate>
                         </asp:TemplateField><asp:TemplateField HeaderText="CANTIDAD" HeaderStyle-HorizontalAlign="Right" 
                     ItemStyle-HorizontalAlign="Right"    HeaderStyle-Width="75px"><ItemTemplate>
                     <asp:Label ID="cantidadLabel" runat="server" BackColor="Transparent" 
                     Text='<%# Eval("cantidadStr")%>'  />

                     </ItemTemplate><EditItemTemplate>
                     <lib:Input ID="cantidadEditTxt" runat="server" BackColor="Transparent"  
                     DataType="Double"   Width="75px"
                     Text='<%# Eval("cantidad")%>' onchange="javascript:calcularTotalXCantReAgrupadoEdit(this);" />
                     </EditItemTemplate><FooterTemplate><lib:Input ID="cantidadInsertTxt"
                      runat="server" BackColor="Transparent" DataType="Double"   Width="75px" Text="0"
                      onchange="javascript:calcularTotalXCantReAgrupadoInsert(this);" /></FooterTemplate>
                      </asp:TemplateField><asp:TemplateField HeaderText="PRECIO" HeaderStyle-HorizontalAlign="Right" 
                     ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="95px">
                     <ItemTemplate><asp:Label ID="precioLabel" runat="server" BackColor="Transparent"
                      Text='<%# Eval("precioStr")%>'  /></ItemTemplate><EditItemTemplate>
                      <lib:Input ID="precioEditTxt" runat="server" BackColor="Transparent" DataType="Double"  
                     Width="95px"       Text='<%# Eval("precio")%>'
                     onchange="javascript:calcularTotalXPrecioAgrupadoEdit(this);" />
                     </EditItemTemplate>
                     <FooterTemplate><lib:Input ID="precioInsertTxt" runat="server" BackColor="Transparent" 
                      Width="95px" DataType="Double" 
                       onchange="javascript:calcularTotalXPrecioAgrupadoInsert(this);" />
                       </FooterTemplate>
                       </asp:TemplateField><asp:TemplateField HeaderText="TOTAL" HeaderStyle-HorizontalAlign="Right" 
                      ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="110px"><ItemTemplate>
                      <asp:Label ID="totalLabel" runat="server" BackColor="Transparent" Text='<%# Eval("totalStr")%>'  /></ItemTemplate><EditItemTemplate><lib:Input ID="totalEditTxt" runat="server" BackColor="Transparent" DataType="Double" 
                      Width="110px" Text='<%# Eval("total")%>' 
                      onchange="javascript:calcularPrecioXTotalAgrupadoEdit(this);" /></EditItemTemplate>
                      <FooterTemplate><lib:Input ID="totalInsertTxt" runat="server" BackColor="Transparent" DataType="Double"  
                      Width="110px"
                        onchange="javascript:calcularPrecioXTotalAgrupadoInsert(this);" /></FooterTemplate>
                        </asp:TemplateField><asp:TemplateField HeaderStyle-Width="20px"><ItemTemplate><asp:ImageButton ID="lnkRemove"
                         runat="server" BorderColor="Control"  
                                    CommandArgument='<%# Eval("idInternal")%>' OnClick="DeleteNewItemRen" 
                                    OnClientClick="return confirm('Usted quiere eliminar?')"  ImageUrl="~/Images/delete.gif"   /></ItemTemplate><FooterTemplate><asp:Button ID="Button1" runat="server" Text="Añadir" CssClass="ms-crm-List-Header" 
                                    OnClick="AddNewItemRen" /></FooterTemplate></asp:TemplateField>
                                    <asp:BoundField DataField="numOrdenCompra" HeaderText="O/C" /></Columns>
                                    </asp:GridView></ContentTemplate></asp:UpdatePanel></asp:Panel></ContentTemplate></asp:TabPanel>
        </asp:TabContainer>

   
 </asp:Panel>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer1$TabPanel1$reusoFinalizadosBTN" />
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosConfiguradoTabPanel$ReAgruparRecursoButton" />


<asp:AsyncPostBackTrigger ControlID="addReABTN" />


</Triggers>
               </asp:UpdatePanel>
       

    <asp:Panel ID="footerButtom" runat="server"         >
        


        <table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="aceptarReAgruparBtn"  runat="server"  Text="Guardar "  CssClass="ms-crm-List-Header"
                      onclick="AddReUsoAgrupado_Click"   OnClientClick="return confirm('Usted quiere Agrupar los Recursos?')"
                       
                        />
                    <asp:Button ID="cancelarReAgruparBtn"  runat="server" Text="Cancelar" 
                         CssClass="ms-crm-List-Header" 
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>

        </asp:Panel> 
 </asp:Panel>
       </asp:Panel>
       



          
  




           <asp:Panel ID="EliReAgrupadoPanelPanel" runat="server"  >
  <asp:Panel ID="EliReAgrupadoPanel"   runat="server"     Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
               <asp:Panel ID="Panel20" runat="server" 
          class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">


            <asp:Panel ID="Panel18" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="EliminarReAgruparBtn"  runat="server"  Text="Eliminar "  CssClass="ms-crm-List-Header"
                      onclick="delRecursoReAgrupado_Click"    OnClientClick="return confirm('Seguro que desea eliminar la Transacción?')" 
                       
                        />
                    <asp:Button ID="CancelarReEliAgruparBtn"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 
<asp:Panel ID="Panel11" runat="server"  
          class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
      <asp:UpdatePanel ID="delReAgrupadoUpdatePanel" runat="server" UpdateMode="Conditional">
      <ContentTemplate>

             <uc5:ECItemElimReAgrupadoPanel ID="ECItemElimReAgrupadoPanel1" DataSourceID="ecItemdelReagrupardds" 
               runat="server" />
               
           <asp:ObjectDataSource ID="ecItemdelReagrupardds" runat="server" EnablePaging="True" 
        SelectCountMethod="Count" SelectMethod="GetAgrupadoList" 
        SortParameterName="sortExpression"
        TypeName="BOL.EstructuraCostoBL">
        <SelectParameters>
            
            <asp:QueryStringParameter Name="idEstructuraCosto" Type="Int32" DefaultValue="0" QueryStringField="id" />
            <asp:QueryStringParameter Name="idOrigen" Type="Int32" DefaultValue="2" QueryStringField="idOrigen" />
            <asp:Parameter Name="startRowIndex" Type="Int32" />
            <asp:Parameter Name="maximumRows" Type="Int32" />
            <asp:Parameter Name="sortExpression" Type="String" />
        </SelectParameters>
        
    </asp:ObjectDataSource>

                </ContentTemplate>


      <Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosConfiguradoTabPanel$eliminarReAgrupadoButton" />
<asp:AsyncPostBackTrigger ControlID="EliminarReAgruparBtn" />



</Triggers>


      
      </asp:UpdatePanel>

       
  </asp:Panel>
               
           </asp:Panel>
               
              


        

        </asp:Panel>
          </asp:Panel>
   


   

      <asp:Panel ID="AddFromOCPanelPanel" runat="server"   CssClass="modalPopup">
  <asp:Panel ID="AddFromOCPanel"   runat="server"    
  BorderColor="LightBlue"  BorderStyle="Solid" Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
              
 

      

 <asp:Panel ID="Panel25" runat="server"  
          class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
      <asp:UpdatePanel ID="ECItemAddOCUPNL" runat="server" UpdateMode="Conditional">
      <ContentTemplate>


    <uc12:ECItemAddOCPanel ID="ECItemAddOCPanel1" runat="server" />
</ContentTemplate>


      <Triggers>
<asp:AsyncPostBackTrigger ControlID="TabContainer2$recursosTabPanel$eliminarAgrupadoButton" />
<asp:AsyncPostBackTrigger ControlID="delRecursoAgrupadoButton" />



</Triggers>


      
      </asp:UpdatePanel>

       
  
               
           </asp:Panel>



             <asp:Panel ID="Panel24" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="addOcItemBTN"  runat="server"  Text="Añadir ordenes de Compra"  CssClass="ms-crm-List-Header"
                          
                         OnClientClick="return confirm('Seguro que desea agregar?')" onclick="Button3_Click" 
                       
                        />
                    <asp:Button ID="cancelAddFromOCBTN"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 


        </asp:Panel>
          </asp:Panel>
      





<asp:Panel ID="addRecurso3ParentPanel" runat="server" Height="410px"  >
  <asp:Panel ID="addRecurso3Panel"   runat="server" Height="410px"  Width="1000px"  Style="background-color:#DDDDDD;border:solid 1px Gray;color:Black">
  <asp:Panel ID="Panel29" runat="server" Height="370px"  class="ms-crm-Dialog-Footer ms-crm-Dialog-Footer-Right">
   
 <uc4:ECItemSeleccionFinalizadoPanel ID="ECItemSeleccionFinalizadoPanel1"  runat="server" />
    </asp:Panel>
 <asp:Panel ID="Panel30" runat="server"   >
        
<table width="100%" >
 <tr  >
               
                <td class=" ms-crm-Dialog-Footer-Right">
               
                     <asp:Button ID="addReABTN"  runat="server"  Text="Agregar "  CssClass="ms-crm-List-Header"
                      onclick="AddSeleccReUsoBtn_Click"  OnClientClick="return confirm('Usted quiere Seleccion los Recursos?')"
                       
                        />
                    <asp:Button ID="cancelarAddFinButton"  runat="server" Text="Cancelar" CssClass="ms-crm-List-Header"
                    
                       
                       />
                   
                </td>
   </tr>


   
</table>
        </asp:Panel> 
           
          
        </asp:Panel>
    
</asp:Panel>






   
      




    






   
      




    






   
      




    






   
      




    </form>
</body>
</html>


